<!DOCTYPE>
<!--
   /******************************************************************************
     Copyright:: 2020- IBM, Inc

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  *****************************************************************************/
-->

<HTML lang="en">

<head>
    <title>A test for Defect 1035:</title>

</head>

<BODY>
    <main>

        <H1>Radio buttons in group element </H1>
        <br>

        <h2>These should pass</h2>
        <!-- Testcase -->
        <div>
            <label>
        <input type="radio" value="good"> NO NAME
    </label>
        </div>

        <!-- Testcase -->
        <div>
            <label>
        <input type="radio" name="good" value="good"> Lone Control with Unique name
    </label>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <label>
            <input type="radio" name="good1" value="good1"> Lone Control with Unique name in a form
        </label>
            </form>
        </div>

        <!-- Testcase -->
        <div>
            <fieldset>
                <legend>Good fieldset</legend>
                <label>
        <input type="radio" name="good2" value="good2"> Good 2a
    </label>
                <label>
        <input type="radio" name="good2" value="good2"> Good 2b
    </label>
            </fieldset>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <fieldset>
                    <legend>Good fieldset</legend>
                    <label>
        <input type="radio" name="good3" value="good3"> Good 3a
        </label>
                    <label>
        <input type="radio" name="good3" value="good3"> Good 3b
        </label>
                </fieldset>
            </form>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <table>
                    <tr>
                        <th>Bad Group</th>
                        <td>
                            <label>
                    <input type="radio" name="bad8" value="bad8"> Bad 8a
                </label>
                            <label>
                    <input type="radio" name="bad8" value="bad8"> Bad 8b
                </label>
                        </td>
                    </tr>
                </table>

                <table>
                    <tr>
                        <th>Bad Group</th>
                        <td>
                            <label>
                    <input type="radio" name="bad9" value="bad9"> Bad 9a
                </label>
                            <label>
                    <input type="radio" name="bad9" value="bad9"> Bad 9b
                </label>
                        </td>
                    </tr>
                </table>
            </form>
        </div>

        <h3>These should fail</h3>

        <!-- Testcase -->
        <div>
            <label>
    <input type="radio" name="bad1" value="bad1"> NO GROUP
    </label>
            <label>
    <input type="radio" name="bad1" value="bad1"> NO GROUP
    </label>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <label>
        <input type="radio" name="bad2" value="bad1"> NO GROUP in form
        </label>
                <label>
        <input type="radio" name="bad2" value="bad1"> NO GROUP in form
        </label>
            </form>
        </div>

        <!-- Testcase -->
        <div>
            <fieldset>
                <legend>Some Legend</legend>
                <label>
        <input type="radio" name="bad3" value="bad3"> HAS GROUP GOOD
    </label>
                <label>
        <input type="radio" name="bad3" value="bad3"> HAS GROUP GOOD
    </label>
            </fieldset>

            <fieldset>
                <legend>Some Legend 2</legend>
                <label>
        <input type="radio" name="bad3" value="bad3"> bad3 outside of FIELDSET
    </label>
            </fieldset>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <fieldset>
                    <legend>Some Legend</legend>
                    <label>
        <input type="radio" name="bad5" value="bad5"> Bad 5a
        </label>
                    <label>
        <input type="checkbox" name="bad5" value="bad5"> Bad 5b
        </label>
                </fieldset>

                <fieldset>
                    <legend>Some Legend 2</legend>
                    <label>
        <input type="checkbox" name="bad5" value="bad5"> Bad 5c - trigger here
        </label>
                </fieldset>
            </form>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <fieldset>
                    <legend>Some Legend 3</legend>
                    <label>
        <input type="checkbox" name="bad6" value="bad6"> Bad 6a
        </label>
                    <label>
        <input type="checkbox" name="bad6" value="bad6"> Bad 6b
        </label>
                </fieldset>

                <label>
        <input type="checkbox" name="bad6" value="bad6"> Bad 6c - trigger here
    </label>
            </form>
        </div>

        <!-- Testcase -->
        <div>
            <form>
                <table>
                    <tr>
                        <th>Bad Group</th>
                        <td>
                            <label>
            <input type="radio" name="bad7" value="bad7"> Bad 7a
            </label>
                            <label>
                <input type="radio" name="bad7" value="bad7"> Bad 7b
            </label>
                        </td>
                    </tr>
                </table>

                <fieldset>
                    <legend>Some Legend 2</legend>
                    <label>
        <input type="radio" name="bad7" value="bad7"> Bad 7c - trigger here
        </label>
                </fieldset>
            </form>
        </div>

    </main>
    <script type="text/javascript">
        //<![CDATA[
        if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
        if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
        OpenAjax.a11y.ruleCoverage = [{
            ruleId: "1029",
            passedXpaths: [],
            failedXpaths: [
            "/html[1]/body[1]/main[1]/div[7]/label[1]/input[1]",
            "/html[1]/body[1]/main[1]/div[7]/label[2]/input[1]",
            "/html[1]/body[1]/main[1]/div[8]/form[1]/label[1]/input[1]",
            "/html[1]/body[1]/main[1]/div[8]/form[1]/label[2]/input[1]",
            "/html[1]/body[1]/main[1]/div[9]/fieldset[2]/label[1]/input[1]",
            "/html[1]/body[1]/main[1]/div[10]/form[1]/fieldset[1]/label[1]/input[1]",
            "/html[1]/body[1]/main[1]/div[10]/form[1]/fieldset[1]/label[2]/input[1]",
            "/html[1]/body[1]/main[1]/div[10]/form[1]/fieldset[2]/label[1]/input[1]",
            "/html[1]/body[1]/main[1]/div[11]/form[1]/label[1]/input[1]",
            "/html[1]/body[1]/main[1]/div[12]/form[1]/fieldset[1]/label[1]/input[1]"
            ]
        }, ];
        //]]>
    </script>
</BODY>

</HTML>